<?php
include("division.php");
if(class_exists('SQL_Helper') != true)
{
   include_once("sql_helper.php");
}
class DivisionRepository
{
	function createDivision($divisionID, $division_name){
		SQL_Helper::executeNonQuery("INSERT INTO `divisions` (`divisionID`, `division_name`) VALUES(?,?)",$divisionID, $division_name);
		
	}
	
	function readDivision($divisionID){
		return SQL_Helper::executeQuerySingle("Select * from `divisions` where `divisionID` = ?", $divisionID);
	}
	
	function updateDivision($divisionID, $division_name){
		SQL_Helper::executeNonQuery("Update `divisions` set `division_name`=? where `divisionID` = ?",$division_name, $divisionID );
	}
	
	function deleteDivision($divisionID){
		SQL_Helper::executeNonQuery("delete from `divisions` where `divisionID` = ?", $divisionID);
	}
	
	function map($row){
		$class= "Division";
		return SQL_Helper::sql_map($row,$class);		
	}
	
	function maps($rows){
		$class= "Division";
		return SQL_Helper::sql_maps($rows,$class);
	}
	
	function allDivision(){
		return SQL_Helper::executeQuery("Select * from `divisions` order by `divisionID`");
	}
}
?>